package com.imooc.util;

/**
 * @author
 * @create 2018-07-26 9:46
 **/
public class PathUtil {
    //获取文件的分割符
    private static String seperator = System.getProperty("file.separator");

    /**
     *  获取图片的路径:返回项目图片的路径
     * @return
     */
    public static String getImgBasePath() {
        String os = System.getProperty("os.name");
        String basePath = "";
        //判断是win还是linux
        if (os.toLowerCase().startsWith("win")) {
            basePath = "C:/image";
        } else {
            basePath = "/home/xiang/";
        }
        basePath = basePath.replace("/", seperator);
        return basePath;
    }

    /**
     * 得到店铺图片路径:根据业务的需求，返回项目图片的子路径
     * @param shopId
     * @return
     */
    public static String getShopImagePath(int shopId) {
        String imagePath = "/upload/item/shop/"+shopId+"/";

        return imagePath.replace("/", seperator);
    }
}
